./scripts/db_ready.sh

# 启动 UI
python -m ui.index & 
# 启动计算 Celery
celery -A compute worker -l INFO &
# 进入 zmm文件目录
cd zmm

if [ "$DJANGO_RESET_DB" = true ]; then
    echo 'Completely resetting database... all previous data will be dropped!'
    python manage.py reset_db
fi

# Migrate ZMM apps
# 迁移django自己的数据模型
# 为我们自己的django app 迁移模型
python manage.py makemigrations common
python manage.py tenant_migrate --public yes

python manage.py makemigrations load_planer
python manage.py tenant_migrate

# Start ZMM apps
# 启动API端的Celery worker &在后台运行  
celery -A celery_client worker -l INFO &
# 启动django API应用
python manage.py runserver 0.0.0.0:8080
